constant array<string> AE_CREDITS =
{
	"SONIC: AMETHYST EARTH",
	"SHC 2025 VERSION",
	" ",
	" ",
	"Credits",
	" ",
	" ",
	"Lead Developer",
	" ",
	"KellyM",
	" ",
	" ",
	"Assistance",
	" ",
	"A S3AIR Modder",
	" ",
	" ",
	"Playtesters",
	" ",
	"PGE",
	"Useott",
	" ",
	" ",
	"Original Authors",
	" ",
	"SEGA",
	"Sonic the Hedgehog",
	" ",
	"Sonic Team",
	"Sonic the Hedgehog 1 & 2",
	" ",
	"Capcom",
	"Street Fighter, CvS",
	" ",
	"ARIKA",
	"Street Fighter EX",
	" ",
	"SNK",
	"King of Fighters, Fatal Fury, SvC Chaos",
	" ",
	"Eukaryot",
	"Sonic 3 A.I.R.",
	" ",
	" ",
	"Music sources",
	" ",
	"Disclaimer - QSound (SFA3)",
	" ",
	"Title - Opening ~Arrange~ (SFEX)",
	" ",
	"Menu - Character Select ~Arrange~ (SFEX)",
	" ",
	"BGZ1 - Precious Heart (SFEX)",
	"BGZ2 - Garnet Sky ~Arrange~ (SFEX)",
	" ",
	"VDZ1 - Flash Train ~Arrange~ (SFEX)",
	"VDZ2 - London Stage (CvS2)",
	" ",
	"Geese Howard - Kiss for Geese (FF)",
	"Akuma - Theme of Akuma / Gouki (SFA)",
	" ",
	"Extra Life - Game Over ~Arrange~ (SFEX)",
	" ",
	"Invincibility - The Infinite Earth ~Arcade~ (SFEX2)",
	" ",
	"Game Over - Game Over ~Arrange~ (SFEX2)",
	" ",
	"Achievement - Here Comes A New Challenger (SFA)",
	" ",
	"Credits - Staff Roll (SFEX3)",
	" ",
	"Scrapped Title - Opening (SFA3)",
	" ",
	" ",
	"Special Thanks",
	" ",
	"The Sonic 3 A.I.R community",
	" ",
	"SHC Staff",
	" ",
	"The Sonic Boll community",
	" ",
	"Dimps",
	" ",
	"azumadeline",
	" ",
	"Timothy",
	" ",
	"And of course..",
	"You!",
	" ",
	" ",
	" ",
	" ",
	"Thanks for playing!",
	"See you in the full version!",
}

function void AE.Credits()
{
	VDP.Config.setActiveDisplay(false)
	fn0011ca()

	VDP.Config.enableHInt(false)
	VDP.Config.setNameTableBasePlaneA(0xc000)
	VDP.Config.setNameTableBasePlaneB(0xe000)
	VDP.Config.setBackdropColor(0x30)
	VDP.Config.setVerticalScrolling(false, 0)
	VDP.Config.setRenderingModeConfiguration(false)
	//VDP.Config.setPlayfieldSizeInPixels(512, 512)
	fn00c02a()

	zeroMemory(0xffffac00, 0x400)
	zeroMemory(0xffffb000, 0x2000)
	u16[0xfffffb00] = 0
	u32[0xfffffbfc] = 0xfffffb00
	level.framecounter = 0

	//UpdateGameObjects()
	//RenderSprites()
	
	Audio.stopChannel(0)
	Audio.playAudio("C_CREDITS_DEMO", 0)
	
	//D2.s8 = 0
	VDP.setupVRAMWrite(0xc000)
	VDP.zeroVRAM(0x4000)

	Renderer.setScreenSize(400, 224)
	Renderer.resetSprites()
	yieldExecution()
		
	VDP.Config.setActiveDisplay(true)
	
	while (true)
	{
		//global.frame_state = 0x1e
		//waitForNextFrame()
		
		Renderer.drawRect(0, 0, getScreenWidth(), getScreenHeight(), 0xff - clamp(level.framecounter, 0, 255), 0xF100, 0, 0)
		
		++level.framecounter
		//Renderer.drawSprite("c_demo_warning", 0, 0, 0x00, 0x00, 0xFFFF)
		Renderer.resetSprites()
		Renderer.drawSprite("c_demo_select_bg", s32(-((level.framecounter / 6) % 448)), 0, 0x00, 0x00, 0xF000)
		Renderer.drawSprite("c_demo_select_bg", (s32(-((level.framecounter / 6) % 448))) + 448, 0, 0x00, 0x00, 0xF000)
		
		SpriteHandle selectshadow = Renderer.addSpriteHandle("c_demo_select_fade", 0, 0, 0xF100)
		selectshadow.setScale(1.0f, getScreenHeight())
		selectshadow.setBlendMode(5)
		
		SpriteHandle selectshadow2 = Renderer.addSpriteHandle("c_demo_select_fade", getScreenWidth(), 0, 0xF100)
		selectshadow2.setScale(-1.0f, getScreenHeight())
		selectshadow2.setBlendMode(5)
		
		for (u8 i = 0; i < AE_CREDITS.length(); i++)
		{
			s32 py = getScreenHeight() + s16(i) * 10 - s16(level.framecounter / 4)
			if (i >= AE_CREDITS.length() - 2)
				py = getScreenHeight() + s16(i) * 10 - s16(clamp(level.framecounter, 0, 0x1090) / 4)
			Renderer.drawText("oxyfont_small", getScreenWidth() / 2, py, AE_CREDITS[i], 0xFFFFFFFF, 2, 0, 0xFFFF, false, true)
		}
		
		if (Input.buttonDown(BUTTON_DOWN) || Input.buttonPressed(BUTTON_A))
			level.framecounter = clamp(s32(level.framecounter) + 16, 0, 62000)
		//else if (Input.buttonDown(BUTTON_UP))
			//level.framecounter = clamp(s32(level.framecounter) - 17, 0, 62000)
		//debugLog(level.framecounter)
		
		if (Input.buttonPressed(BUTTON_START) || Input.buttonPressed(BUTTON_B) || level.framecounter >= 0x1200)
		{
			//Audio.playAudio("sf2_sound_css_select")
			/*
			global.game_mode = 0x04		// Title Screen
			u32 backupA0 = A0
			FadeOutScreenBlocking()
			A0 = backupA0
			global.game_mode = 0x04		// Title Screen
			
			yieldExecution()
			return
			*/
			//Audio.playAudio("C_SFX_UI_CANCEL")
			AE.ReturntoMainMenu()
			return
		}
		
		yieldExecution()
	}
}